package com.mall.service.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mall.model.domain.OmsOrderReturnReason;
import com.mall.service.order.mapper.OmsOrderReturnReasonMapper;
import com.mall.service.order.service.OmsOrderReturnReasonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OmsOrderReturnReasonServiceImpl extends ServiceImpl<OmsOrderReturnReasonMapper, OmsOrderReturnReason> implements OmsOrderReturnReasonService {
    
    @Autowired
    OmsOrderReturnReasonService omsOrderReturnReasonService;

    /**
     * 获取单个退货原因详情信息
     * @param id
     * @return
     */
    @Override
    public OmsOrderReturnReason getByInfo(Long id) {
        OmsOrderReturnReason omsOrderReturnReason = this.getById(id);
        return omsOrderReturnReason;
    }

    /**
     * 修改退货原因启用状态
     * @param ids
     * @param status
     */
    @Override
    public void updateWithStatus(List<Long> ids, int status) {
        for (Long id : ids) {
            OmsOrderReturnReason byId = omsOrderReturnReasonService.getById(id);
            byId.setStatus(status);
        }
    }

    /**
     * 修改退货原因
     * @param id
     * @param omsOrderReturnReason
     */
    @Override
    public void updateWhitReason(Long id, OmsOrderReturnReason omsOrderReturnReason) {
        omsOrderReturnReasonService.getById(id);
        omsOrderReturnReasonService.updateById(omsOrderReturnReason);
    }
}
